home *** CD-ROM | disk | FTP | other *** search
/ BUG 6 / BUGCD1997_09.BIN / APLIC / PAGEMAKR / ARCHIVE.Z / Nested Group.SPT < prev    next >
Text File  |  1996-10-31  |  2KB  |  65 lines

  1. -- Nested Group
  2. -- 1 Oct 96, vs
  3.  
  4. -- This script will allow you to create a "nested group"
  5. -- which can contain other groups.  When you then run
  6. -- the "nested ungroup" script, the original groups will 
  7. -- be retained.
  8.  
  9. getselectidlisttop => N,selectidlisttop
  10. set => newgrouplist
  11. set => newTOC
  12. loop n=1,N
  13.     set selectidlisttop => id,...,...,...,type,...,...,...,...,...,...,...,...,...,...,selectidlisttop
  14.     if not(type=14)
  15.         set newgrouplist,id=>newgrouplist
  16.     else
  17.         try getprivatestring "Vlad","NGrp",classobject,0,id => npd,TOC
  18.         if not(npd?0,1)
  19.             rem this group is not nested
  20.             getgrouplist id => M,grouplist
  21.             set => grouplist[id]
  22.             set newTOC,id=>newTOC
  23.             loop m=1,M
  24.                 set grouplist=> id.g,...,...,...,type.g,...,...,...,...,...,...,...,...,...,...,grouplist
  25.                 if type.g=14
  26.                     message "Bad structure of a nonnested group id #" + str(id)
  27.                     return
  28.                 endif
  29.                 set grouplist[id],id.g=>grouplist[id]
  30.             endloop
  31.         else
  32.             rem this group is nested
  33.             set ~""(TOC)=>TOC
  34.             set newTOC,TOC=>newTOC
  35.             while not(empty(TOC))
  36.                 set TOC=>id.g,TOC
  37.                 try getprivatestring "Vlad","NGrp",classobject,id.g,id => npd,grouplist[id.g]
  38.                 if not(npd?0,1)
  39.                     message "Bad structure of a nonnested group id #" + str(id)
  40.                     return
  41.                 endif
  42.                 set ~""(grouplist[id.g])=>grouplist[id.g]
  43.             endwhile
  44.         endif
  45.         set -id,newgrouplist=>newgrouplist
  46.     endif
  47. endloop
  48. group
  49. getselectidlisttop => ...,newId,...
  50. set newgrouplist=>grouplist[newId]
  51. if (listlens(""(grouplist[mewId]))>255)+(listlens(""(newId,newTOC))>255)
  52.     message "Group too big. Script terminated."
  53.     return
  54. endif
  55. privatestring "Vlad","NGrp",classobject,newId,1,newId,1,""(grouplist[newId])
  56. privatestring "Vlad","NGrp",classobject,0,1,newId,1,""(newId,newTOC)
  57. while not(empty(newTOC))
  58.     set newTOC=>id.g,newTOC
  59.     privatestring "Vlad","NGrp",classobject,id.g,1,newId,1,""(grouplist[id.g])
  60. endwhile
  61. return
  62.  
  63.  
  64.  
  65.